package cc;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.function.Consumer;
import java.util.function.Supplier;

public class MinecraftModding {

    public static void main(String[] args) throws Exception {
//        Java Introduction for Minecraft Modding (2023) - 31: Some More Java Things to consider!
//        final int x = 100;//final修饰符,赋值之后就不能改变
//        var y = 100;//可变的类型变量,100 y就是整数,"aaa" y就是字符串

//        Java Introduction for Minecraft Modding (2023) - 30: JSON
        //讲了json格式

//        Java Introduction for Minecraft Modding (2023) - 29: Records
        //记录
        //暂时不知道有什么用
        //Player DiYu = new Player("diyu",30);
        //System.out.println(DiYu);//自动打印所有信息

//        Java Introduction for Minecraft Modding (2023) - 28: Lambda & Streams
        //匿名函数
        //简单的理解就是把函数当成变量使用,可以减少参数的传递
        //SayHello();//将会执行SayHello方法中的函数
        //Runnable runnable = () -> System.out.println("Hello World");//这样也可以执行
        //runnable.run();
        //Supplier<Float> pi = () -> 3.14159265f;
        //Consumer<Runnable> test =runnable1 -> runnable1.run();
        //test.accept(runnable);
        //暂时没看懂是个什么意思
        //流
        /*
        List<String> list = List.of("apple", "pear", "Banana", "Mango");
        list.stream().filter(fruit -> fruit.startsWith("M"))
                .forEach(fruit -> System.out.println(fruit));

         */


//        Java Introduction for Minecraft Modding (2023) - 27: Generics
        /*
        //泛型
        //感觉这个东西有点乱
        BlockStorage<Block> blocks = new BlockStorage<>();
        blocks.addBlock(new WoodBlock());
        blocks.addBlock(new Stone());
        blocks.displayStorage();
         */
//        Java Introduction for Minecraft Modding (2023) - 26: Exceptions & Try and Catch
        /*

        //异常处理
        // 100/0会抛出异常
        try {
            int x = 100 / 0;
        }catch (Exception e) {
            System.out.println(e.getMessage());
        }
        int x = 100;
        if(x == 100) {
            throw new Exception("随便抛出个异常");
        }

         */

//        Java Introduction for Minecraft Modding (2023) - 25: Enums & Advanced Enums
        /*
        //枚举和高级枚举
//        一种基础的数据类型
//        游戏难度
//        Difficultly GameDifficultly = Difficultly.HARDCORE;
//        System.out.println(GameDifficultly);
        //工具材料
        ToolMaterail myAxeMaterail = ToolMaterail.WOOD;
        ToolMaterail myPickaxeMaterail = ToolMaterail.IRON;
        System.out.println("My Axe Materail has " + myAxeMaterail.getDurability()+" Durability");

         */

//        Java Introduction for Minecraft Modding (2023) - 23: Anonymous Classes
        /*
//        匿名类
        //背景:我想创建一个仓鼠,但是我没有仓鼠这个类,而且我不想创建仓鼠这个类,所以只能从动物里面衍生出来
        //直接实例化Animal会报错,因为Animal是抽象的
//        Animal Jeely = new Animal("Jeely",123);
        //所以我们需要用到匿名类(没有名字)
        Animal Jeely = new Animal("Jeely",123){
            @Override
            public void move() {
                System.out.println("Jeely is moving...");
            }

            @Override
            public void makeSound() {
                System.out.println("Jeely is making sound...");
            }
        };
        Jeely.makeSound();
        Jeely.move();

         */

//        Java Introduction for Minecraft Modding (2023) - 22: Interfaces & Abstract Classes
        /*
        //接口和抽象类
//        Animal类现在是抽象类,不可以实例化(你不能创建一个种类为动物的动物)
//        Animal ss = new Animal();

        //创建一只鸟
        Animal Jules = new Bird("cc",100);
        Jules.move();
        //不能直接调用Bird.fly
        ((Bird) Jules).fly();//如果要调用就要转化成Bird类
         */


//        Java Introduction for Minecraft Modding (2023) - 21: Inheritance & Polymorphism
        /*
        //讲的继承
        //先创建两只狗
        Dog dog1 = new Dog("00",0);
        Dog dog2 = new Dog("01",0);
        //也可以通过父类来创建
        Animal dog3 = new Dog("02",0);
        dog2.brithday();
        System.out.println(dog1.getAge());
        System.out.println(dog2.getAge());
        //创建猫
        Animal mao = new Cat("00",0);
        //狗叫
        dog2.makeSound();
        //猫叫(已经被覆写)
        mao.makeSound();
        //创建马
        Animal house1 = new House("00",0);
        //马叫
        house1.makeSound();
         */

//        Java Introduction for Minecraft Modding (2023) - 20: Access Modifiers
        //这节讲了几个访问修饰符(public protected private)
        //public 公开访问
        //protected 在同一个包里面可以访问
        //private 在同一个类里面才可以访问

        //static 可以直接访问,而不是创建实例之后才可以访问
        //这样可以创建一个所有类实例都共享的属性,例如这个类的实例的数量(实例化的时候通过构造函数增加数量)

//        Java Introduction for Minecraft Modding (2023) - 18: Object Oriented Programming
        //这节讲的类和对象
        //一些类的基础应用

//        Java Introduction for Minecraft Modding (2023) - 17: Exercise 2
        //这节是个练习,跳过
        //        Java Introduction for Minecraft Modding (2023) - 16: Collections
        //讲集合类数据类型(List Array Set Map)
        //Map类似于python中的字典(Dict)

//        Java Introduction for Minecraft Modding (2023) - 15: Methods
        //函数的基础定义和使用
        //跳过

//        Java Introduction for Minecraft Modding (2023) - 14: Arrays
        //数组Arrays
        //字符串数组
        /*
        String[] strArr = new String[10];//可以装10个元素
        strArr[0] = "dsafdsa";
        strArr[1] = "dsafdsa";
        strArr[2] = "dsafdsa";
        strArr[3] = "dsafdsa";
        strArr[4] = "dsafdsa";
        strArr[5] = "dsafdsa";
        System.out.println(strArr[0]);//通过索引访问
         */

//        Java Introduction for Minecraft Modding (2023) - 13: String & String Methods
        //这节讲字符串的一些函数的应用
        //跳过

//        Java Introduction for Minecraft Modding (2023) - 12: Casting Variables
        //这节讲的是一系列的数据类型转换,包含强转和隐式转换等.
        //跳过

//        Java Introduction for Minecraft Modding (2023) - 11: Ternary Operator
        // 三元运算符 ?:
        //int health = 100;
        //boolean isAlive = health>0?true:false;
        //System.out.println("is Tim alive?" + isAlive);

//        Java Introduction for Minecraft Modding (2023) - 10: Exercise 1
        //练习一 写个计算器
        //直接跳过

//        Java Introduction for Minecraft Modding (2023) - 9: Loops
        /*
        //这里是循环结构 For & while & do...while
        //这里是我自己学的,没看视频
        //For
        for (int i = 0; i < 100;i++ ){
            System.out.println(i);
        }

        //while
        int i = 100;
        while(i>=0){
            System.out.println(i);
            i--;
        }

        //do...while
        do{
            System.out.println(i);
            i++;
        }while(i<=100);
        */

//        Java Introduction for Minecraft Modding (2023) - 8: If & Switch Statements
        //这里应该是讲的条件语句或者是分支语句

        //IF & Switch
        //IF
        /*
        System.out.println("How many health do you have?");
        Scanner sc = new Scanner(System.in);
        int health = sc.nextInt();
        boolean isAlive = health > 0;
        if (isAlive) {
            System.out.println("You are alive!");
        }else {
            System.out.println("You are dead!");
        }

        System.out.println("How many points do you have?");
        int points = sc.nextInt();
        if(points > 50 ) {
            System.out.println("You passed!");
        }else{
            System.out.println("You lost!");
        }


        //Switch
        int x = 3;
        switch (x){
            case 1:System.out.println("x is 1!");break;
            case 2:System.out.println("x is 2!");break;
            case 3:System.out.println("x is 3!");break;
            default:System.out.println("x has not matched!");break;
        }
        */

//        Java Introduction for Minecraft Modding (2023) - 7: Assignment Operators
        //应该是一些基础的运算符
        //应该是一些自增运算符
        //int num = 100;
        /*
        // Assignment =
        int num = 100;
        System.out.println(num);
        num += 200; // equals num = num + 200;
        System.out.println(num);
        num++; //equals num = num + 1;
        System.out.println(num);
        */

        //subtraction -=
        //num -= 10;
        //System.out.println(num);
        //num--;
        //System.out.println(num);

        //Multiply *=
        //num *= 10;
        //System.out.println(num);
        //没有 num**; 这种写法

        //Divide /=
        //num /= 10;
        //System.out.println(num);

        //Modulo (Remainder) %d
        //num %= 10;
        //System.out.println(num);

        /*
        //Java Introduction for Minecraft Modding (2023) - 6: Booleans & Logic
        //布尔值和逻辑运算符
        //一些布尔值和逻辑运算符的基础运用

        //COMPARISONS 这个应该是比较运算( > < >= <= != == )
        int point = 77;
        int pointToPass = 55;
        boolean hasPass = point >= pointToPass; //大于或者是等于就为true
        System.out.println("Has pass the test: "+hasPass);

        int health = 0;
        boolean isAlive = health > 0;//判断是否存活
        System.out.println("Is alive: "+isAlive);

        //logic ==> 逻辑运算符(and or not) 与或非
        boolean passTest1 = true;
        boolean passTest2 = false;
        boolean hasHonors = passTest1 || passTest2;//或 其中一个为真就为真
        hasHonors = passTest1 && passTest2;//与 两个为真才为真
        hasHonors = !passTest1;//非 取反


        //输入是否是欧洲人,不是欧洲人则是米国人
        //eu18 us21
        System.out.println("Are you from Europe? Type true or false!");
        Scanner sc =  new Scanner(System.in);//输入函数
        boolean isEurope = sc.nextBoolean();//判断输入
        int euDrinkingAge = 18;
        int usDrinkingAge = 21;
        System.out.print("Type your age:");
        int age = sc.nextInt();
        if((isEurope && age >= euDrinkingAge) || (!isEurope && age <= usDrinkingAge)) {
            System.out.println("You can drinking!!!");
        }
        */

        //布尔值要么是true(1)要么是false(1)
        /*
        boolean isTutorial = true;
        System.out.println("这是一个Minecraft的java的认识教程");

        boolean isCreative = false;//是否是创造模式
        if (!isCreative) {
            System.out.println("不是管理员,拒绝访问");
        }
        */

        //Java Introduction for Minecraft Modding (2023) - 5: Integers & Math
        //这节应该是将的一些基础的整数变量的运用.
        /*
        int a = -100;
        int b = 200;
        int sum = a+b; //加法
        System.out.println(sum);

        int sub = a-b; //减法
        System.out.println(sub);

        int multi = a * b; //乘法
        System.out.println(multi);

        int division = a / b; //除法,这里的 / 号是整除的意思,所以100/200等于0余100
        System.out.println(division);

        int remainder = a % b; //取模,100取模200余100,所以结果是100
        System.out.println(remainder);

        //一些数学函数
        System.out.println("Absolute:"+ Math.abs(a)); //数学函数,取绝对值
        System.out.println("Ceiling:"+ Math.ceil(0.83)); //数学函数,取整(小数),向上取
        System.out.println("Floor:"+ Math.floor(0.83)); //数学函数,取整(小数),向下取
        System.out.println("Round:"+ Math.round(0.3)); //数学函数,取整(整数),四舍五入
        //最大值和最小值
        System.out.println("Maximum:"+ Math.max(0.5,0.9));//返回最大值
        System.out.println("Minimum:"+ Math.min(0.5,0.9));//返回最小值
        */


        //Java Introduction for Minecraft Modding (2023) - 4:Input && Output
        //这节讲的应该是输入输出语句
        //输出语句
        //System.out.println("Hello World!");
        //int a = 100;
        //System.out.println(a);//输出变量
        //System.out.println("a is "+ a);//拼接输出

        //输入语句
        //Scanner sc = new Scanner(System.in);//输入语句
        //int num = sc.nextInt();//将输入的东西转换成数字
        //System.out.println("你输入的内容是:"+num);//输出
        //next输入空格之前的一串字符,nextline输入包含空格的多个字符
        //String s1 =sc.nextLine();//把输入转换成String
        //System.out.println("sc.next|||||"+s1);//输出s1

        //Java Introduction for Minecraft Modding (2023) - 3:Java Syntxa
        //这节讲的应该是java的基础语法
        //int num;//声明变量
        //num = 100;//赋值
        //int num1 = 100;//初始化变量(声明+赋值)
        //注意每条语句都需要以分好(;)结束

        //Java Introduction for Minecraft Modding (2023) - 2: Data Types
        //这节视频简单讲述了(我猜的,有点听不懂)
        // 单行注释//
        /* 多行注释 */

        //定义变量的规范
        //数据类型 变量名;
        //变量名 = 值;
        //或者是
        //数据类型 变量名 = 值;

        //还有一系列的数据类型
        //Integers(数字) ==> int
        //取值从-2147483648 到 2147483647
        //int num;
        //num = 100;
        //或者
        //int num = -100

        //floating(浮点数) ==> float
        // float float_num;
        // float_num = 3.15f ;
        // 或者
        // float float_num = 3.24144143f;
        // double double_num = 2.144321432;

        //booleans(True || False)
        //boolean btrue = true;
        //boolean bfalse = false;

        //Chars && String
        //char a = 'a'; //单引号
        //String aa = "aa"; //双引号

        //Java Introduction for Minecraft Modding (2023) - 1: Setup
        //System.out.println("Hello world!");
        //System.out.println("教成来源于YouTube");
        //System.out.println("https://www.youtube.com/watch?v=G1ifRRtJm7w");
        //System.out.println("现在再看的是\nJava Introduction for Minecraft Modding (2023) - 1: Setup");
    }
}